package com.heima.feigns.fallback;
import com.heima.feigns.ApUserFeign;
import com.heima.model.user.pojos.ApUser;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
@Component
@Slf4j
public class UserFeignFallback implements FallbackFactory<ApUserFeign> {
    @Override
    public ApUserFeign create(Throwable throwable) {
        throwable.printStackTrace();
        return new ApUserFeign() {
            @Override
            public ApUser findApUserById(Integer id) {
                log.error("Feign服务降级触发 远程调用:ApUserFeign  findApUserById 失败,参数:{}",id);
                return null;
            }
        };
    }
}